using ASP;
using HoWave.Common;
using HoWave.Web;
using HoWave.Web.Admin;
using System;
using System.Collections;
using System.Data;
using System.Web.Profile;
using System.Web.SessionState;
using System.Web.UI.WebControls;
public class HL_Admin_Admin_ShopPayInfoView : Admin, IRequiresSessionState
{
	protected DropDownList DropeBankID;
	protected DropDownList DropStatus;
	protected DropDownList UserType;
	protected TextBox TxtUserName;
	protected TextBox TxtBeginDate;
	protected TextBox TxtEndDate;
	protected Button Button1;
	protected GridView GridView1;
	protected Label PagePanel;
	protected Button Button3;
	private string wherestr = "";
	private string linkhead = "";
	private ArrayList al = new ArrayList();
	private IDbDataParameter[] param = null;
	private bool tag = true;
	private Pagination _pagination;
	protected DefaultProfile Profile
	{
		get
		{
			return (DefaultProfile)this.Context.Profile;
		}
	}
	protected global_asax ApplicationInstance
	{
		get
		{
			return (global_asax)this.Context.ApplicationInstance;
		}
	}
	protected Pagination m_pagination
	{
		get
		{
			Pagination pagination;
			if (this._pagination == null)
			{
				this._pagination = new Pagination();
				this._pagination.P_Object = "记录";
				pagination = this._pagination;
			}
			else
			{
				pagination = this._pagination;
			}
			return pagination;
		}
	}
	protected void Page_Load(object sender, EventArgs e)
	{
		if (!base.admin.CheckAdminPower(21))
		{
			base.WriteLog("View", Language.GetAdminMsg("Log/Access", "0"), "PayInfor");
			base.WriteRightErrMsg();
		}
		if (!base.admin.CheckAdminPower(21))
		{
			this.Button3.Enabled = false;
		}
		if (!base.IsPostBack)
		{
			this.BangList();
			this.TxtBeginDate.Attributes.Add("onClick", "SelectDate(" + this.TxtBeginDate.UniqueID + ",'yyyy-MM-dd');");
			this.TxtEndDate.Attributes.Add("onClick", "SelectDate(" + this.TxtEndDate.UniqueID + ",'yyyy-MM-dd');");
		}
	}
	protected void BangList()
	{
		this.QuestString();
		if (this.al.Count > 0)
		{
			this.param = new IDbDataParameter[this.al.Count];
			this.al.CopyTo(this.param, 0);
		}
		int num = Fetch.GetID("page");
		if (num == 0)
		{
			num = 1;
		}
		int pageSize = this.GridView1.PageSize;
		if (this.param != null)
		{
			this.GridView1.DataSource = this.m_pagination.GetDataTable("HLShop_PayInfo", num, pageSize, "PaymentID", this.wherestr, "", this.conn, this.param);
		}
		else
		{
			this.GridView1.DataSource = this.m_pagination.GetDataTable("HLShop_PayInfo", num, pageSize, "PaymentID", this.wherestr, "", this.conn, null);
		}
		this.GridView1.DataBind();
		this.m_pagination.P_LinkHead = this.linkhead;
		this.PagePanel.Text = this.m_pagination.ShowPagePanel();
	}
	protected void QuestString()
	{
		string text = Fetch.Get("uname");
		if (text != string.Empty && this.tag)
		{
			this.TxtUserName.Text = text.Trim();
		}
		else
		{
			text = this.TxtUserName.Text;
		}
		if (text != string.Empty)
		{
			text = text.Trim();
			string text2 = Fetch.Get("utype");
			if (text2 != string.Empty && this.tag)
			{
				this.UserType.SelectedValue = text2;
			}
			else
			{
				text2 = this.UserType.SelectedValue;
			}
			if (text2 == "0")
			{
				this.wherestr += "and UserName like '%'+ @UserName +'%' ";
			}
			else
			{
				this.wherestr += "and SalerID in(Select UserID From HL_User Where UserName like '%'+ @UserName +'%') ";
			}
			this.al.Add(this.conn.CreateParameter("@UserName", DbType.String, text));
			string text3 = this.linkhead;
			this.linkhead = string.Concat(new string[]
			{
				text3,
				"&uname=",
				base.Server.UrlEncode(text),
				"&utype=",
				text2
			});
		}
		string text4 = Fetch.Get("bankid");
		if (text4 != string.Empty && this.tag)
		{
			this.DropeBankID.Text = text4;
		}
		else
		{
			text4 = this.DropeBankID.SelectedValue;
		}
		if (text4 != string.Empty)
		{
			if (!Text.IsNumber(text4))
			{
				this.wherestr = this.wherestr + "and eBankID='" + text4 + "' ";
			}
			else
			{
				this.wherestr += "and eBankID<>'ShopBank' and eBankID<>'AliPay' ";
			}
			this.linkhead = this.linkhead + "&bankid=" + text4;
		}
		string text5 = Fetch.Get("status");
		if (text5 != string.Empty && this.tag)
		{
			this.DropStatus.Text = text5;
		}
		else
		{
			text5 = this.DropStatus.SelectedValue;
		}
		if (text5 != string.Empty)
		{
			this.wherestr = this.wherestr + "and Status='" + text5 + "' ";
			this.linkhead = this.linkhead + "&status=" + text5;
		}
		string text6 = Fetch.Get("begindate");
		string text7 = Fetch.Get("enddate");
		if (!string.IsNullOrEmpty(text6) && this.tag)
		{
			this.TxtBeginDate.Text = text6;
		}
		else
		{
			text6 = this.TxtBeginDate.Text.Trim();
		}
		if (!string.IsNullOrEmpty(text6))
		{
			this.wherestr = this.wherestr + " and (DATEDIFF(DD,PayTime,'" + text6 + "'))<=0";
			this.linkhead = this.linkhead + "&begindate=" + text6;
		}
		if (!string.IsNullOrEmpty(text7) && this.tag)
		{
			this.TxtEndDate.Text = text7;
		}
		else
		{
			text7 = this.TxtEndDate.Text.Trim();
		}
		if (!string.IsNullOrEmpty(text7))
		{
			if (text6 != null && text6 != "")
			{
				if (Convert.ToDateTime(text6) > Convert.ToDateTime(text7))
				{
					this.WriteErrMsg("", Language.Get("Common/DateTimeErr"), "");
				}
			}
			this.wherestr = this.wherestr + "and (DATEDIFF(DD,PayTime,'" + text7 + "'))>=0";
			this.linkhead = this.linkhead + "&enddate=" + text7;
		}
		if (this.wherestr != string.Empty)
		{
			this.wherestr = "and" + this.wherestr;
			this.wherestr = this.wherestr.Replace("andand", "where");
		}
	}
	protected void OnSearch(object sender, EventArgs e)
	{
		this.tag = false;
		this.BangList();
	}
	protected void Button3_Click(object sender, EventArgs e)
	{
		string text = Fetch.GetOrPost("PaymentIDs");
		text = Text.CheckNumList(text);
		if (text != string.Empty)
		{
			Shop_PayInfo shop_PayInfo = new Shop_PayInfo(this.conn);
			shop_PayInfo.DeletePayInfo(text);
			this.BangList();
		}
	}
	protected void DeleteInfor(object sender, CommandEventArgs e)
	{
		if (e.CommandArgument != null)
		{
			int num = Text.ToInt32(e.CommandArgument);
			if (num > 0)
			{
				Shop_PayInfo shop_PayInfo = new Shop_PayInfo(this.conn);
				shop_PayInfo.DeletePayInfo(num.ToString());
				this.BangList();
			}
		}
	}
	protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
	{
		e.Row.Attributes.Add("onmouseover", "c=this.style.backgroundColor;this.style.backgroundColor='#E7EDFE'");
		e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=c;");
	}
}
